#include <bits/stdc++.h>
using namespace std;

int a,b,c,e,f,g[100010],h[100010],j[100010],k,l,o[100010],p;

int main(){
    freopen("detect.in","r",stdin);
    freopen("detect.out","W",stdout);
    scanf("%d%d%d%d%d%d" ,&a ,&b ,&c ,&e ,&f);
    for(int i = 1;i <= b;i++)
        scanf("%d%d%d" ,&g[i] ,&h[i] ,&j[i]);
    for(int i = 1;i <= c;i++)
        scanf("%d" ,&o[i]);
    for(int i = 1;i <= b;i++){
        if(h[i]>f && o[i]>=2*h[i])
            k++;
        if(j[i]>=0)
            p++;
    }
    printf("%d %d" ,k, p);
    return 0;
}
